package com.spc.web;

import com.spc.pojo.Product;
import com.spc.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Autowired
    private IProductService productService;

    @GetMapping("getproduct/{id}")
    public Product getProduct(@PathVariable("id") Integer id){
//        try {
//            Thread.sleep(3000);//模拟eureka访问超时eureka默认超时1000
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return productService.getProduct(id);
    }
}
